//
//  BLVipPriceCell.m
//  Byelone
//
//  Created by Qi Liu on 2021/3/6.
//

#import "BLVipPriceCell.h"

@interface BLVipPriceCell()
@property (weak, nonatomic) IBOutlet UIImageView *lineImage;
@property (weak, nonatomic) IBOutlet UILabel *priceType;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UIImageView *selectImage;
@property (weak, nonatomic) IBOutlet UIView *baseView;

@end

@implementation BLVipPriceCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _baseView.layer.cornerRadius = 10;
    _baseView.layer.borderColor = [UIColor whiteColor].CGColor;
    _baseView.layer.borderWidth = 1;
    
    NSString * priType = [NSString stringWithFormat:@"%@元",@"30"];
    NSRange rangeTextFont = {0,priType.length -1};
    NSRange rangeTextFont01 = {priType.length -1,1};
    NSRange rangeTextColor = {0,priType.length};

    NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc]initWithString:priType];
    [attributeStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:19] range:rangeTextFont];//字体
    [attributeStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:rangeTextFont01];//字体
    [attributeStr addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:rangeTextColor];
    self.priceLabel.attributedText = attributeStr;
}

-(void)setPriceSelect:(BOOL)priceSelect{
    _priceSelect = priceSelect;
    NSString * str = _priceSelect ? @"lineYellow":@"lineWhite";
    UIImage * lineImage = [UIImage imageNamed:str];
    _lineImage.image = lineImage;
    _selectImage.hidden = !_priceSelect;
    
    UIColor * textColor = _priceSelect ? [UIColor chColorWithHexString:@"F6B056"]:[UIColor whiteColor];
    NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc]initWithString:_priceLabel.text];
    [attributeStr addAttribute:NSForegroundColorAttributeName value:textColor range:NSMakeRange(0, _priceLabel.text.length)];
    self.priceLabel.attributedText = attributeStr;
}


-(void)setDic:(NSDictionary *)dic{
//    _dic = dic;


    NSString * priType = [NSString stringWithFormat:@"%@元",@"30"];
    
    NSRange rangeTextFont = {0,priType.length -1};
    NSRange rangeTextFont01 = {priType.length -2,1};
    NSRange rangeTextColor = {0,priType.length};

    NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc]initWithString:priType];
    
    [attributeStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:19] range:rangeTextFont];//字体
    [attributeStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:rangeTextFont01];//字体
    [attributeStr addAttribute:NSForegroundColorAttributeName value:[UIColor chColorWithHexString:@"#F6B056"] range:rangeTextColor];
    self.priceLabel.attributedText = attributeStr;
}


@end
